//package cn.base.web.cahe;
//
//import cn.base.web.config.LoginProperties;
//import com.github.benmanes.caffeine.cache.Cache;
//import com.github.benmanes.caffeine.cache.Caffeine;
//import com.github.benmanes.caffeine.cache.Expiry;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cache.CacheManager;
//import org.springframework.cache.caffeine.CaffeineCache;
//import org.springframework.cache.support.SimpleCacheManager;
//import org.springframework.stereotype.Component;
//
//import jakarta.annotation.PostConstruct;
//import java.time.Duration;
//import java.util.*;
//import java.util.concurrent.ConcurrentHashMap;
//import java.util.concurrent.CopyOnWriteArrayList;
//@Component
//public class CacheNameConfig {
//
//
//    private CacheNameConfig(){
//
//    }
//
//    private final SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
//    @PostConstruct
//    private void init(){
//        //原始Caffeine使用方式
//        //Cache cache= Caffeine.newBuilder().maximumSize(1000).expireAfter(new SessionExpiry(Duration.ofMinutes(3))).build();
//
//        List<CaffeineCache> caches = new ArrayList<>();
//        caches.add(new CaffeineCache("session",
//                Caffeine.newBuilder().expireAfter(new SessionExpiry(loginProperties.getTokenTimeout())).build()));
//        simpleCacheManager.setCaches(caches);
//
//    }
//
//    public CacheManager getTemporaryCacheManager(){
//        return simpleCacheManager;
//    }
//}
